
import { Gender } from '@type/common';
import { IsString, IsInt, MinLength, MaxLength, Allow, validate, Contains, IsIn, IsOptional } from 'class-validator';
import { Type, Transform, Expose } from "class-transformer";
import { StringHelper } from '@utils/string.helper';
export class RegisterForm {

    @MinLength(6, {message: '用户名长度大于6个字符'})
    @MaxLength(18, {message: '用户名长度小于6个字符'})
    @Transform(({ value }) => StringHelper.trim(value))
    username: string;

    @MinLength(6, {message: '密码长度大于6个字符'})
    @MaxLength(18, {message: '密码长度小于6个字符'})
    @Transform(({ value }) => StringHelper.trim(value))
    password: string;

    @Allow()
    avator: string;

    @Type(() => Number)
    @IsInt()
    @Allow()
    gender: Gender = Gender.UNKOWN;

    @MinLength(1, {message: '别称长度大于6个字符'})
    @MaxLength(18, {message: '别称长度小于6个字符'})
    @Transform(({ value }) => StringHelper.trim(value))
    nickname: string;
    
}